import Article from '@/views/Article.vue';
import ArticleDetail from '@/views/ArticleDetail.vue';
import Collect from '@/views/Collect.vue';
import Layout from '@/views/Layout.vue';
import Like from '@/views/Like.vue';
import NotFound from '@/views/NotFound.vue';
import User from '@/views/User.vue';
import Vue from 'vue'
import VueRouter from "vue-router";
Vue.use(VueRouter)

const router = new VueRouter({
  // 去除井号
  mode: "history",
  // 配置路由表
  routes: [
    {path:"/",redirect:"/article"},//redirect重定向
    {path: "/", component: Layout,
      // 子路由，二级路由
      children:[
        {path:'article',component:Article},
        {path:'collect' , component:Collect} , 
        {path:'like',component:Like},
        {path:'user',component:User}
      ]
    },
    // 动态tail/:id?',//:id?表示id是可选的
    {path:"/detail/:id?",component:ArticleDetail},
    {path:"*",component:NotFound}//404
  ]
})

export default router